﻿<Window x:Class="PortableDeviceExplorer.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:pde="clr-namespace:PortableDeviceExplorer"
    DataContext="{Binding Path=MainWindowViewModel, Source={StaticResource Locator}}"
    Title="Portable Device Explorer" Height="480" Width="640">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*"  />
        </Grid.RowDefinitions>
        
        <!-- Main application menu -->
        <Menu>
            <MenuItem Header="File">
                <MenuItem Header="Scan for devices" Command="{Binding Path=RefreshConnectedDeviceCommand}" />
                <MenuItem Header="Connect to device" ItemsSource="{Binding Path=PortableDevices}" >
                    <MenuItem.ItemTemplate>
                        <DataTemplate>
                            <MenuItem Header="{Binding}" 
                                      Command="{Binding Path=MainWindowViewModel.ConnectToDeviceCommand, Source={StaticResource Locator}}" 
                                      CommandParameter="{Binding}" />
                        </DataTemplate>
                    </MenuItem.ItemTemplate>
                </MenuItem>
                <MenuItem Header="Disconnect from device" Command="{Binding Path=DisconnectFromDeviceCommand}" />
                <Separator />
                <MenuItem Header="Quit" />
            </MenuItem>
            <MenuItem Header="Test">
                <MenuItem Header="Execute command" Command="{Binding Path=ExecuteCommandCommand}" />
            </MenuItem>
        </Menu>
        
        <pde:PortableDeviceViewer Grid.Row="1"/>
    </Grid>
</Window>
